<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.14.
   家居公司招标显示($$)*/

!defined('Q_PATH') && exit;

class Show_C_Controller extends InitController{

	public function index(){
		$nId=intval(Q::G('id','G'));

		if(!$nId){
			$this->page404();
		}

		// 招标显示
		$arrWhere=array();
		$arrWhere['A.jiajubidding_status']=1;
		$arrWhere['A.jiajubidding_id']=$nId;

		$arrBidding=Model::F_('jiajubidding','@A')
			->setColumns('A.create_dateline,A.jiajubidding_title,A.jiajubidding_id,A.jiajubidding_realspace,A.jiajubidding_issupervision,A.jiajubidding_iskey,A.jiajubidding_realprice,A.jiajubidding_way,A.jiajubidding_starttime,A.jiajubidding_ismaterial,A.jiajubidding_realname,A.jiajubidding_sex,A.jiajubidding_mobile,A.jiajubidding_qq,A.jiajubidding_address,A.jiajubidding_remark,A.jiajubidding_feedback,A.jiajubidding_viewnum')
			->where($arrWhere)
			->joinLeft(Q::C('DB_PREFIX').'jiajucompanyclass AS D','D.jiajucompanyclass_name AS style_name','A.jiajubidding_styleid=D.jiajucompanyclass_id')
			->joinLeft(Q::C('DB_PREFIX').'jiajucompanyclass AS E','E.jiajucompanyclass_name AS space_name','A.jiajubidding_spaceid=E.jiajucompanyclass_id')
			->joinLeft(Q::C('DB_PREFIX').'district AS G','G.district_name AS district_name','A.district_id=G.district_id')
			->getOne();

		if(empty($arrBidding['jiajubidding_id'])){
			$this->page404();
		}

		// 更新点击量
		Model::M_('jiajubidding')->updateWhere(array('jiajubidding_viewnum'=>$arrBidding['jiajubidding_viewnum']+1),'jiajubidding_id=?',$nId);
		$arrBidding['jiajubidding_viewnum']++;

		Core_Extend::getSeo($this,array(
			'title'=>"{$arrBidding['jiajubidding_title']}招标 - {$GLOBALS['_option_']['site_name']}装修招标网",
			'keywords'=>"{$arrBidding['jiajubidding_title']}招标,{$GLOBALS['_option_']['site_name']}装修招标网",
			'description'=>"{$arrBidding['jiajubidding_title']}招标 - {$GLOBALS['_option_']['site_name']}装修招标网",
		));

		$this->assign('arrBidding',$arrBidding);
		$this->display('biddings+show');
	}

}
